<template>
  <div class="page-content page-prj">
    <div class="page-prj__center flex-y">
      <CenterTop :CenterTopData="CenterTopData" class="flex-2" />
      <CenterBottom class="flex-1" mt-20 />
    </div>
    <div class="page-prj__right flex-y">
      <RightTop :emergencyEvents="emergency_events" class="flex-1" />
      <RightCenter :regionDevice="region_device" class="flex-1" mt-20 />
      <RightBottom class="flex-1" mt-20 />
    </div>
  </div>
</template>

<script setup>
import { getMains } from "@/api/operation-board";
import { onMounted, reactive, ref, onUnmounted } from "vue";
// center
import CenterTop from "./parts/center-top.vue";
import CenterBottom from "./parts/center-bottom.vue";

// right
import RightTop from "./parts/right-top.vue";
import RightCenter from "./parts/right-center.vue";
import RightBottom from "./parts/right-bottom.vue";
// 监控点
const CenterTopData = reactive({
  monitor: {
    monitor: {},
    devices: {},
  },
  camera_vqd: {}, //视频质量诊断统计
  camera_record: {}, // 视频录像诊断统计
  camera_type_lists: {}, // 监控点类型
  emergency_events: {}, //紧急事件
  region_device: {}, //•区域设备运维情况
});
const emergency_events = ref([]);
const region_device = ref([]);
// 设备总数
let timer;

onMounted(() => {
  getDataList();
  timer = setInterval(getDataList, 10000);
});
onUnmounted(() => {
  clearInterval(timer);
});
function getDataList() {
  getMains().then((res) => {
    if (res.code === 1) {
      CenterTopData.monitor.monitor = res.data.monitor_num;
      CenterTopData.monitor.devices = res.data.devices_num;
      CenterTopData.camera_vqd = res.data.camera_vqd;
      CenterTopData.camera_record = res.data.camera_record;
      CenterTopData.camera_type_lists = res.data.camera_type_lists;
      emergency_events.value = res.data.emergency_events;
      region_device.value = res.data.region_device;
    }
  });
}
</script>

<style lang="scss" scoped>
.page-prj {
  justify-content: space-between;

  &__left,
  &__right {
    width: 540px;
  }

  &__center {
    margin: 0px 20px;
    position: relative;
    flex: 1;
    width: 0px;
    display: flex;
    flex-direction: column;
  }

  .legend-box {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 13px 15px;
    border: 1px solid #24c1f7;
    z-index: 100;
    background-color: rgba(18, 33, 76, 0.8);
    display: flex;
    flex-direction: column;

    .el-checkbox {
      &:nth-child(n + 2) {
        margin-top: 16px;
      }

      --el-checkbox-disabled-checked-input-fill: #409eff;
      --el-checkbox-disabled-checked-input-border-color: #409eff;
      --el-checkbox-disabled-checked-icon-color: #ffffff;

      ::v-deep(.el-checkbox__label) {
        display: inline-flex;
        align-items: center;
      }

      img {
        width: 28px;
      }

      span {
        margin-left: 10px;
        font-weight: 600;
        font-weight: 500;
        font-size: 16px;
        color: #cfe9ff;
      }
    }
  }
}

.content-box1 {
  ::v-deep {
    .content-box {
      width: 70% !important;
    }
  }
}
</style>

<style lang="scss">
.prj-name {
  flex: 2 !important;
}

.dept-name {
  min-width: 300px !important;
}
</style>
